package com.webinsky.common.proj;

public enum BookMode {
	Mold("mold", 1), Press("press", 2);
	
	private String mode;
	private int id;
	
	private BookMode(String mode, int id){
		this.mode = mode;
		this.id = id;
	}
	
	public String getMode(){
		return mode;
	}
	
	public int getId(){
		return id;
	}
	
	public static BookMode parse(int id){
		for ( BookMode mode : BookMode.values() ){
			if ( mode.getId() == id ){
				return mode;
			}
		}
		return null;
	}
	
	public static BookMode parse(String strMode){
		for ( BookMode mode : BookMode.values() ){
			if ( mode.getMode().equals(strMode) ){
				return mode;
			}
		}
		return null;
	}
}
